import { Application } from "egg";
import { Lockers } from "./lockers";

export default class CodoLockersDevice {
	constructor(private app: Application) {}

	/**
	 *  重启设备
	 * @param {string} addr 设备地址 i.e. 127.0.0.1:9000
	 */
	async reboot(addr: string) {
		const fullPath = `${addr}/reBoot?code=1`;
		const res = await this.app.curl<Lockers.Response.GetLogList>(fullPath, {
			method: "GET",
			dataType: "json",
			headers: {
				"content-type": "multipart/form-data",
				// "content-type": "x-www-urlencoded",
			},
			data: {},
		});
		return res.data;
	}
}
